<template>
  <div>
    <!-- data对应数据 -->
    <!-- row-key 选择的依据 通过id选择 -->
    <!-- tree-props 属性数据的属性 -->
    <!-- default-expand-all 默认展开所有子集 -->
    <el-table
      :data="tableData"
      style="width: 100%; margin-bottom: 20px"
      row-key="id"
      border
      default-expand-all
      :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
    >
      <!-- sortable 排序 -->
      <el-table-column prop="uid" label="用户ID" width="180"> </el-table-column>
      <el-table-column prop="nickname" label="昵称" width="180">
      </el-table-column>
      <el-table-column prop="phone" label="手机号" width="180">
      </el-table-column>
      <el-table-column prop="addtime" label="注册日期" width="180">
        <template slot-scope="scope">
          <div>
            {{Number(scope.row.addtime)|fomatetime('yyyy-mm-dd h:m:s')}}
          </div>
        </template>
      </el-table-column>
      <el-table-column label="操作">
        <div>
          <el-button
            type="primary"
            icon="el-icon-edit"
            circle
            size="mini"
          ></el-button>
        </div>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import { memberList } from "@/api.js";
export default {
  data() {
    return {
      tableData: [],
    };
  },
  created() {
    this.getMember();
  },
  methods: {
    async getMember() {
      let res = await memberList();
      console.log(res);
      this.tableData = res.list;
    },
  },
};
</script>
<style scoped>
</style>